package com.atguigu.daijia.driver.controller;

import com.atguigu.daijia.common.login.GuiguLogin;
import com.atguigu.daijia.common.result.Result;
import com.atguigu.daijia.driver.service.MonitorService;
import com.atguigu.daijia.model.form.order.OrderMonitorForm;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@Slf4j
@Tag(name = "监控接口管理")
@RestController
@RequestMapping(value = "/monitor")
@SuppressWarnings({"unchecked", "rawtypes"})
@RequiredArgsConstructor
public class MonitorController {

    private final MonitorService MonitorService;

    /**
     * 保存订单监控记录
     *
     * @param file             代驾期间的监控音频
     * @param orderMonitorForm 代驾期间的监控音频的文本内容
     * @return
     */
    @Operation(summary = "保存订单监控记录")
    @GuiguLogin
    @PostMapping("/saveOrderMonitorRecord")
    public Result<Boolean> saveOrderMonitorRecord(@RequestParam("file") MultipartFile file, @RequestBody OrderMonitorForm orderMonitorForm) {
        Boolean result = MonitorService.saveOrderMonitorRecord(file, orderMonitorForm);
        return Result.ok(result);
    }
}

